home *** CD-ROM | disk | FTP | other *** search
/ Yolanda Bergman's Good Health, Great Food / GoodHealth.iso / pc / yolanda.dxr / Internal_34_New Recipe Index.ls < prev    next >
Encoding:
Text File  |  1998-03-11  |  3.3 KB  |  112 lines

  1. property pCurrentFilterBtn
  2. global FORWARD, BACKWARD, SPRITE_GRID, SPRITE_BOX, SPRITE_SMALLFOTO, SPRITE_DESCRIPTION, SPRITE_FILTER_FIRST, SPRITE_FILTER_LAST, SPRITE_PGBWD_BTN, SPRITE_PGFWD_BTN, SPRITE_RECIPE_FIRST, SPRITE_RECIPE_LAST, SPRITE_HDR, CAST_DUMMY_RECPIC, CAST_SMFOTOS_BASE, CAST_DESCRIPTION_BASE, gSpriteNumber, gReturnPressed, gpage, gGridObj
  3.  
  4. on new me
  5.   set pCurrentFilterBtn to SPRITE_FILTER_FIRST
  6.   downbutton(pCurrentFilterBtn)
  7.   set h to the left of sprite SPRITE_GRID - 195
  8.   set v to the top of sprite SPRITE_GRID - 150
  9.   set rows to 12
  10.   set cols to 1
  11.   set gGridObj to new(script "NEW GRID", SPRITE_GRID, SPRITE_BOX, [h, v], [rows, cols], [377, 24], [2, 2])
  12.   SetFilter(1)
  13.   return me
  14. end
  15.  
  16. on setlastpage
  17.   set gpage to getpage(gGridObj)
  18. end
  19.  
  20. on returntoindex me
  21.   spriteVisible(41, 52, 0)
  22.   set the visible of sprite 14 to 0
  23.   SetFilter(pCurrentFilterBtn - SPRITE_FILTER_FIRST + 1)
  24.   downbutton(pCurrentFilterBtn)
  25.   setPage(gGridObj, gpage)
  26.   ViewRecipePics(1)
  27.   updateStage()
  28.   spriteVisible(41, 52, 1)
  29.   set the visible of sprite 14 to 1
  30. end
  31.  
  32. on HandleFilterBtn me, UpOrDown
  33.   case UpOrDown of
  34.     #mouseDown:
  35.       if (gSpriteNumber = pCurrentFilterBtn) and (gSpriteNumber <> SPRITE_FILTER_LAST) then
  36.         exit
  37.       end if
  38.       upbutton(pCurrentFilterBtn)
  39.       downbutton()
  40.       puppetSound("camera.aif")
  41.     #mouseUp:
  42.       if (gSpriteNumber = pCurrentFilterBtn) and (gSpriteNumber <> SPRITE_FILTER_LAST) then
  43.         exit
  44.       end if
  45.       if (the clickOn <> gSpriteNumber) and not gReturnPressed then
  46.         exit
  47.       end if
  48.       set pCurrentFilterBtn to gSpriteNumber
  49.       SetFilter(pCurrentFilterBtn - SPRITE_FILTER_FIRST + 1)
  50.   end case
  51.   return 
  52. end
  53.  
  54. on SetFilter index
  55.   global gRecipeObj
  56.   setCatNdx(gRecipeObj, index)
  57.   if getNumOfRecipes(gRecipeObj) = 0 then
  58.     set gSpriteNumber to SPRITE_FILTER_FIRST
  59.     alert("No matches found")
  60.     upbutton(pCurrentFilterBtn)
  61.     downbutton()
  62.     set pCurrentFilterBtn to gSpriteNumber
  63.     SetFilter(1)
  64.     exit
  65.   end if
  66.   ResetGrid(gGridObj, getNumOfRecipes(gRecipeObj), index)
  67.   ViewRecipePics(1)
  68. end
  69.  
  70. on GoNEXTInSequence me, direction
  71.   GoNextPage(gGridObj, direction)
  72.   ViewRecipePics(1)
  73. end
  74.  
  75. on handleRollover me
  76.   global glastsprite
  77.   if the rollOver = glastsprite then
  78.     exit
  79.   end if
  80.   set pageNumber to getpagenumber(gGridObj)
  81.   set currentSprite to the rollOver
  82.   set cell to currentSprite - 40
  83.   set x to ((pageNumber - 1) * 12) + cell
  84.   set RecipesL to GetRecipeList(gRecipeObj)
  85.   if (currentSprite >= SPRITE_RECIPE_FIRST) and (currentSprite <= SPRITE_RECIPE_LAST) and (x <= count(RecipesL)) then
  86.     set the rect of sprite SPRITE_BOX to the rect of sprite currentSprite
  87.     ViewRecipePics(cell)
  88.     updateStage()
  89.   end if
  90.   set glastsprite to currentSprite
  91. end
  92.  
  93. on ResetFilterBtns me
  94.   global gSpriteNumber
  95.   if gSpriteNumber <> pCurrentFilterBtn then
  96.     downbutton(pCurrentFilterBtn)
  97.     upbutton(gSpriteNumber)
  98.   end if
  99. end
  100.  
  101. on ViewRecipePics cell
  102.   global gRecipeObj, SPRITE_SUPERPIC, glastsprite
  103.   set pageNumber to getpagenumber(gGridObj)
  104.   set x to ((pageNumber - 1) * 12) + cell
  105.   setCatRecNdx(gRecipeObj, x)
  106.   set category to getCatNdx(gRecipeObj)
  107.   set iRecipe to getRecipeNumber(gRecipeObj, category, x)
  108.   set the memberNum of sprite SPRITE_SUPERPIC to GetSuperPIC(gRecipeObj, iRecipe)
  109.   set the memberNum of sprite SPRITE_DESCRIPTION to iRecipe
  110.   set glastsprite to 0
  111. end
  112.